package com.rykj.energy.common.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by hexiaobo@rykj.com on 2018/4/2.
 */
public enum BusinessType {

    sfsb(70001,"身份识别", "sfsb"),        //身份识别
    rlcq(70002, "人员查寝","rlcq"),        //查寝
    djsb(70003, "打架检测","djsb"),        //打架
    dljc(70004,"逗留检测", "dljc"),        //逗留
    wpyl(70005, "物品遗留","wpyl"),        //物品遗留
    yhjc(70006, "烟火检测","yhjc"),        //烟火识别
    jjjc(70007, "聚集检测","jjjc"),        //聚集检测
    qycr(70008, "人员非法入侵","qycr"),        //区域闯入
    hmdjc(70009, "黑名单检测","hmdjc"),      //黑名单检测
    bmdjc(70010,"非授权人员检测", "bmdjc"),      //非授权人员检测
    rlkq(70011, "人脸考勤","rlkq"),        //人脸考勤
    dpjc(70012, "低频人员检测","dpjc"),        //低频人员检测
    zdry(70013, "重点人员防控","zdry"),        //重点人员检测
    CallTheRoll(70014, "点名","CallTheRoll"),//点名
    aqmjc(70015, "安全帽检测","aqmjc"),      //安全帽检测
    ldjc(70016, "落单检测","ldjc"),        //落单检测
    tgjc(70017, "脱岗检测","tgjc"),        //脱岗检测
    sjjc(70018, "睡岗检测","sjjc"),        //睡觉检测
    ddhjc(70019, "打电话检测","ddhjc"),      //打电话检测
    lsjc(70020, "落水检测","lsjc"),        //落水检测
    pgjc(70022, "攀高检测","pgjc"),        //攀高检测
    qsjc(70023,"起身检测", "qsjc"),        //起身检测
    zyjc(70024, "自缢检测","zyjc"),        //自缢检测
    wqjc(70025, "手持武器检测","wqjc"),        //手持武器检测
    rlljc(70026, "人流量检测","rlljc"),      //人流量检测
    sdjc(70027, "摔倒检测","sdjc"),        //摔倒检测
    msrsb(70028, "陌生人识别","msrsb"),      //陌生人识别
    ywjc(70029,"烟雾检测","ywjc"),//烟雾检测
    lgjc(70030, "离岗检测","lgjc"),        //离岗检测
    ddjc(70031, "跌倒检测","ddjc"),        //跌倒检测
    jtxwjc(70032,"静态行为检测", "jtxwjc"),    //静态行为检测
    yctljc(70033, "异常停留检测","yctljc"),    //异常停留检测
    ycpcjc(70034, "异常频次检测","ycpcjc"),    //异常频次检测
    xfqcjc(70035,"消防器材检测", "xfqcjc"),    //消费器材检测
    gzfjc(70036,"安全服检测", "gzfjc"),   //工作服检测
    cyjc(70037, "抽烟检测","cyjc"),    //抽烟检测
    clljc(70038, "车辆统计","clljc"),    //车辆统计
    wsjc(70039,"污水检测", "wsjc"),    //污水检测
//    hyjc(70040,"hyjc"),//火焰检测,目前使用的上面的yhjc
    wpcjc(
            70041,"无牌车辆加油防控","wpcjc"),//无牌车辆加油防控


    xyzy(70044,"卸油作业","xyzy"),//卸油作业
    ygcsr(70045,"油罐车驶入卸油区","xyzy_ygcsr"),//油罐车驶入卸油区
    cdgzf(70046,"穿戴工作服","xyzy_cdgzf"),//穿戴工作服

    pdaqm(70047,"佩戴安全帽","xyzy_pdaqm"),//佩戴安全帽
    qlxzr(70048,"清理闲杂人员及车辆","xyzy_qlxzr"),//清理闲杂人员及车辆
    szjjwl(70049,"设置警戒围栏和警示牌","xyzy_szjjwl"),//设置警戒围栏和警示牌
    mhqlzzt(70050,"灭火器处于临战状态","xyzy_mhqlzzt"),//灭火器处于临战状态
    mhtlzzt(70051,"灭火毯处于临战状态","xyzy_mhtlzzt"),//灭火毯处于临战状态
    ljjdjd(70052,"连接静电接地线","xyzy_ljjdjd"),//连接静电接地线
    ygcjz(70053,"油罐车静止15分钟以上","xyzy_ygcjz"),//油罐车静止15分钟以上
    ypdbcy(70054,"油品底部油取样","xyzy_ypdbcy"),//油品底部油取样
    ljygchqg(70055,"司机连接油罐车回气管","xyzy_ljygchqg"),//司机连接油罐车回气管
    ljcyhqg(70056,"值班经理连接储油罐回气管","xyzy_ljcyhqg"),//值班经理连接储油罐回气管
    ljygcxyg(70057,"司机连接油罐车卸油管","xyzy_ljygcxyg"),//司机连接油罐车卸油管
    ljcygxyg(70058,"值班经理连接储油罐卸油管","xyzy_ljcygxyg"),//值班经理连接储油罐卸油管
    srzxyc(70059,"双人在卸油现场监卸","xyzy_srzxyc"),//双人在卸油现场监卸
    gdljsx(70060,"管道连接顺序","xyzy_gdljsx"),//管道连接顺序
    ygcxyfgb(70061,"油罐车卸油阀门关闭","xyzy_ygcxyfgb"),//油罐车卸油阀门关闭
    dycz(70062,"底油操作","xyzy_dycz"),//底油操作
    yqhsgcc(70063,"油气回收管拆除","xyzy_yqhsgcc"),//油气回收管拆除
    ygcsl(70064,"油罐车驶离卸油区","xyzy_ygcsl"),//油罐车驶离卸油区
    zbjd(70065,"准备阶段","xyzy_zbjd"),//准备阶段
    xyzc(70066,"卸油操作","xyzy_xycz"),//卸油操作
    xyjs(70067,"卸油结束","xyzy_xyjs"),//卸油结束

    lssb(70068,"漏水检测","lssb"),//漏水检测
    lyjc(70069,"漏油检测","lyjc"),//漏油检测
    rdjc(70070,"人员统计","rdjc"),//人员统计
    cpjc(70071,"车牌抓拍检测","cpjc"),//车牌抓拍检测
    qpjc(70072,"现场气瓶摆放检测","qpjc"),//现场气瓶摆放检测
    mhqjc(70073,"消防器材摆放检测","mhqjc"),//消防器材摆放检测

    aqsjc(70074,"安全绳检测","aqsjc"),//安全绳检测
    wjjjc(70075,"挖掘机检测","wjjjc"),//挖掘机检测
    sbzdjc(70076,"监控遮挡检测","sbzdjc"),//监控遮挡检测
    xzzyaqjc(70077,"旋转作业安全检测","xzzyaqjc"),//旋转作业安全检测
    gjjc(70078,"工具摆放检测","gjjc"),//工具摆放检测
    //ddjc(70079,"人员倒地检测","ddjc"),//人员倒地检测
    dwzr(70080,"吊物站人检测","dwzr"),//吊物站人检测

    aqqjc(70081,"现场警示标志围栏设置","aqqjc"),//现场警示标志围栏设置
    aqxjc(70082,"没穿戴劳鞋识别","aqxjc"),//没穿戴劳鞋识别

    gdzr(70083,"管道站人检测","gdzr"),//管道站人检测
    jsdjc(70084,"回填警示带检测","jsdjc"),//回填警示带检测

    hjybjc(70085,"焊接咬边检测","hjybjc"),//焊接咬边检测
    hjhpjc(70086,"焊接焊偏检测","hjhpjc"),//焊接焊偏检测
    hjwrhjc(70087,"焊接侧壁未熔合检测","hjwrhjc"),//焊接侧壁未熔合检测
    hjtcjc(70088,"焊接填充不足检测","hjtcjc"),//焊接填充不足检测
    hjhljc(70089,"焊接焊瘤检测","hjhljc"),//焊接焊瘤检测
    dccrjc(70090,"大车闯入检测","dccrjc"),//大车闯入检测

    wjjdzjc(70091,"挖掘机吊装检测","wjjdzjc"),//挖掘机吊装检测
    xthtjc(70092,"细土回填检测","xthtjc"),//细土回填检测
    njxljc(70093,"泥浆泄露检测","njxljc"),//泥浆泄露检测
    gjcjc(70094,"工程车检测","gjcjc"),//车辆类型识别
    cldl(70095,"车辆逗留","cldl"),
    qyfk(70096,"区域防控","qyfk"),
    xjqycr(70097,"巡检区域闯入","xjqycr"),
    xjrlsb(70098,"巡检人脸识别","xjrlsb"),
    dzstjc(70099,"管沟土质检测","dzstjc"),
    xjjc(70100,"巡检检测","xjjc"),
    sfsbtj(70101,"身份识别统计","sfsbtj"),
    dxcljc(70102,"大型车辆检测","dxcljc"),
    hydxjc(70103,"火焰大小检测","hydxjc"),
    wdjc(70104, "区域温度检测","wdjc"),
    offline(70105, "设备离线检测","offline"),
    xdwjc(70106, "小动物闯入检测","xdwjc"),
    zqwjc(70107, "蒸汽雾检测","zqwjc"),
    doorOpen(70108, "管道破损","doorOpen"),
    yewei(70109, "液位","yewei"),
    switchs( 70110, "阀门开关状态","switchs"),
    pointerMeter(70111, "指针表","pointerMeter"),
    lightColor(70112, "状态指示灯","lightColor"),
    goodsFall(70113, "零部件脱落","goodsFall");

    public int bNo;
    public String bName;
    public String bType;

    BusinessType(int bNo, String bName, String bType){
        this.bType = bType;
        this.bName = bName;
        this.bNo = bNo;
    }

    public static BusinessType parse(int bNo){
        for(BusinessType type : values()){
            if(type.getbNo() == bNo){
                return type;
            }
        }
        return null;
    }

    public static BusinessType parse(String bType){
        for(BusinessType type : values()){
            if(type.getbType().equals(bType)){
                return type;
            }
        }
        return null;
    }

    public int getbNo() {
        return bNo;
    }

    public String getbType() {
        return bType;
    }

    /**
     * 是否为人脸相关任务
     */
    public static boolean isFaceTask(String businessType){
        List<String> faceTasks = new ArrayList<>();
        faceTasks.add(BusinessType.hmdjc.getbType());
        faceTasks.add(BusinessType.bmdjc.getbType());
        faceTasks.add(BusinessType.sfsb.getbType());
        faceTasks.add(BusinessType.rlcq.getbType());
        faceTasks.add(BusinessType.rlkq.getbType());
        faceTasks.add(BusinessType.zdry.getbType());
        faceTasks.add(BusinessType.dpjc.getbType());
        return faceTasks.contains(businessType);
    }

    public static List<Map<String, Object>> toBusinessList(){
        List<Map<String, Object>> list = new ArrayList<>();
        BusinessType[] b = BusinessType.values();
        for(BusinessType type : b){
            Map map = new HashMap();
            map.put("engName",type.bType);
            map.put("dataName",type.bName);
            map.put("number",type.bNo);
            list.add(map);
        }

        return list;
    }

    public static void main(String[] args) {
        System.out.println(BusinessType.parse("lssb").bName);
    }
}
